<template>
    <div style="width: 412px;margin: 0 auto;">
        <el-form :model="form" status-icon ref="form" label-width="100px" class="demo-ruleForm">
            <el-form-item label="零售商id" prop="retailerId" style="width:380px">
                <el-input type="input" v-model="form.retailerId" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="姓名" prop="retailerName" style="width:380px">
                <el-input type="input" v-model="form.retailerName" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="地址" prop="address" style="width:380px">
                <el-input type="input" v-model="form.address" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="电话号码" prop="telephone" style="width:380px">
                <el-input type="input" v-model="form.telephone" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="submit()">提交</el-button>
            </el-form-item>

        </el-form>

    </div>
</template>

<script>
import axios from "../../utils/api";

export default {
    name: "AddRetailer",
    data() {
        return {
            form: {
                retailerId: '',
                retailerName: '',
                address: '',
                telephone: ''
            },
        };
    },
    methods: {
        submit() {
          axios.post(axios.defaults.baseURL + "/addRetailer", this.form).then(res => {
            if (res.data.data === 1) {
              //alert("添加成功")
              this.$emit("changVisiable")
            }else{
              alert("添加失败")
            }
          }).catch(function (error) {
            alert(error);
            console.log(error);
          })
        }
    },

}
</script>

<style scoped>
</style>
